package thinkingInJava;

public class Learn17 {

	public static void main(String[] args) {
		int[] is=new int[10];
		is[1]=1;
		System.out.println(is.length);
		for (int i : is) {
			System.out.println(i);
		}
		MyMap<String,Object> myMap=new MyMap<String,Object>(1);
		myMap.put("good", "good");
		System.out.println(myMap);
		System.out.println(myMap.get("good"));
	}

}
class MyMap<K,V>{
	private Object[][] objs;
	private Integer index=0;
	public MyMap(Integer length){
		this.objs=new Object[length][2];
	}
	public void put(K key,V value){
		objs[index++]=new Object[]{key,value};
	}
	@SuppressWarnings("unchecked")
	public V get(K key){
		for(int i=0;i<objs.length;i++){
			if(objs[i][0].equals(key)){
				return (V) objs[i][1];
			}
		}
		return null;
	}
	@Override
	public String toString() {
		return this.index+"index:"+this.objs[0][0];
	}
}
